<template>
    <div class="dashboard-container">
        <List v-if="page == 'list'" @changePage="changePage" />

        <Add v-if="page == 'add'"  @changePage="changePage" />
        <Edit v-if="page == 'edit'" :row="dataRow" @changePage="changePage" />
       
    </div>
</template>

<script>
import List from "./list";
import Add from "./add";
import Edit from "./edit";

export default {
    name: 'znjk',
    components: {
        List,
        Add,
        Edit
      
    },
    data() {
        return {
            loading: false,
            nsrsbh: '',
            page: "list", 
            dataRow:{}
        }
    },

    mounted() {
    },
    methods: {
        changePage(page, payload) {
            console.log(page, payload)
            if (payload && page == "add") {
                this.nsrsbh = payload.nsrsbh || "";
            }
            if (payload && page == "edit") {
                this.dataRow = payload || "";
            }
            if (this.page == page) {
                this.page = "";
                this.$nextTick(() => {
                    this.page = page;
                });
            } else {
                this.page = page;
            }

            console.log(this.page)
        },

    }
}
</script>

<style lang="scss" scoped>
.dashboard-container {
    width: 100%;
    min-height: 100%;
    background-color: #fff;
    padding: 8px;

}
</style>
